<f:view
		xmlns="http://www.w3.org/1999/xhtml"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:a4j="http://richfaces.org/a4j"
		xmlns:rich="http://richfaces.org/rich"
		xmlns:ui="http://java.sun.com/jsf/facelets"
		xmlns:itdep="http://itdep.bsuir.by/jsf"
		>
	<f:loadBundle basename="bundle.address" var="addressBundle"/>
	<ui:decorate template="/facelets/template/mainTemplate.xhtml">
		<ui:define name="title">#{addressBundle.cityList}</ui:define>
		<ui:define name="center">
			<ui:decorate template="/facelets/template/centerTemplate.xhtml">
				<ui:define name="content">
					<ui:decorate template="/facelets/template/scrollableTableTemplate.xhtml">
						<ui:param name="anyValue" value="true"/>
						<ui:param name="actionBean" value="#{cityDictionaryBean}"/>
						<ui:param name="idPrefix" value="cityDic"/>
						<ui:define name="editPanelContext">
							<h:panelGrid id="cityDicEditPanel" columns="2">
								<h:outputText value="#{addressBundle.country}" styleClass="requiredField"/>
								<itdep:entitySelectMenu value="#{cityDictionaryBean.filter.country}"
														entityType="country" format="{name}" styleClass="sizeCopmonent">
									<a4j:support event="onchange" reRender="cityDicEditPanel" ajaxSingle="true"/>
								</itdep:entitySelectMenu>
								<h:outputText value="#{addressBundle.region}" styleClass="requiredField"/>
								<itdep:entitySelectMenu value="#{cityDictionaryBean.filter.region}"
														filter="#{cityDictionaryBean.filter}"
														entityType="region" format="{name}"
														disabled="#{empty cityDictionaryBean.filter.country}"
														styleClass="sizeCopmonent">
									<a4j:support event="onchange" reRender="cityDicEditPanel" ajaxSingle="true"/>
								</itdep:entitySelectMenu>
								<h:outputText value="#{addressBundle.district}" styleClass="requiredField"/>
								<itdep:entitySelectMenu value="#{cityDictionaryBean.filter.district}"
														filter="#{cityDictionaryBean.filter}"
														entityType="district" format="{name}"
														disabled="#{empty cityDictionaryBean.filter.region}"
														styleClass="sizeCopmonent">
									<a4j:support event="onchange" reRender="cityDicEditPanel" ajaxSingle="true"/>
								</itdep:entitySelectMenu>
								<h:outputText value="#{addressBundle.settlement}" styleClass="requiredField"/>
								<itdep:entitySelectMenu value="#{cityDictionaryBean.record.settlement}"
														filter="#{cityDictionaryBean.filter}"
														entityType="settlement" format="{name}"
														disabled="#{empty cityDictionaryBean.filter.district}"
														styleClass="sizeCopmonent">
									<a4j:support event="onchange" reRender="cityDicEditPanel" ajaxSingle="true"/>
								</itdep:entitySelectMenu>
								<h:outputText value="#{addressBundle.cityType}" styleClass="requiredField"/>
								<itdep:entitySelectMenu value="#{cityDictionaryBean.record.cityType}"
														entityType="city-type" format="{i18n.fullName}"
														disabled="#{empty cityDictionaryBean.record.settlement}"
														styleClass="sizeCopmonent">
									<a4j:support event="onchange" reRender="cityDicEditPanel" ajaxSingle="true"/>
								</itdep:entitySelectMenu>
								<h:outputText value="#{addressBundle.cityCode}"/>
								<h:inputText value="#{cityDictionaryBean.record.cityCode}"
											 disabled="#{empty cityDictionaryBean.record.cityType}"
											 styleClass="sizeCopmonent" maxlength="50"/>
								<h:outputText value="#{addressBundle.city}" styleClass="requiredField"/>
								<h:panelGroup>
									<h:inputText id="cityDicInput" value="#{cityDictionaryBean.record.name}"
												 required="true" disabled="#{empty cityDictionaryBean.record.cityType}"
												 styleClass="sizeCopmonent" maxlength="100"/>
									<itdep:errorMessage for="cityDicInput"/>
								</h:panelGroup>
							</h:panelGrid>
						</ui:define>
						<ui:define name="tableContext">
							<rich:column>
								<f:facet name="header">
									<h:outputText value="#{addressBundle.id}"/>
								</f:facet>
								<h:outputText value="#{record.id}"/>
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="#{addressBundle.settlement}"/>
								</f:facet>
								<h:outputText value="#{record.settlement.name}"/>
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="#{addressBundle.cityType}"/>
								</f:facet>
								<itdep:entityOutput value="#{record.cityType}" format="{i18n.fullName}"
													locale="#{translationBean.locale}"/>
							</rich:column>
							<rich:column>
								<f:facet name="header">
									<h:outputText value="#{addressBundle.city}"/>
								</f:facet>
								<h:outputText value="#{record.name}"/>
							</rich:column>
						</ui:define>
					</ui:decorate>
				</ui:define>
			</ui:decorate>
		</ui:define>
	</ui:decorate>

</f:view>